/**
 * render list
 * 
 * @param {}
 *            value
 * @param {}
 *            cellmeta
 * @param {}
 *            record
 * @param {}
 *            rowIndex
 * @param {}
 *            columnIndex
 * @param {}
 *            store
 * @return {}
 */
function renderTQExtListHeader(value, cellmeta, record, rowIndex, columnIndex,
		store) {
	var cm = getGridCm('cms_news_list');
	var fieldName = cm.getDataIndex(columnIndex);
	if (fieldName == 'NS_THUMBNAIL' ) {
		if (value != null && typeof(value) == 'object') {
			inithelper();
			
			var valueString = '';
			Ext.each(value, function(item, idx) {
				var annexId = item.id;
				var annexName = item.name;
				var annexType = item.type;
				valueString += '<a href="javascript:void(0);" title="查阅附件" onclick="javascript:viewAnnex(\''
						+ annexId + '\');">' + annexName + "." + annexType + '</a><br/>';
			});
			return valueString;
		}
		return value;
	} else if (fieldName == 'SP') {
		return '<a href="javascript:void(0);" onclick="javascript:edit(\''
				+ record.data['PK_ID']
				+ '\', \''
				+ record.data['NS_NAME']
				+ '\');">编辑</a>&nbsp;<a href="javascript:void(0);" onclick="javascript:del(\''
				+ record.data['PK_ID']
				+ '\', \''
				+ record.data['NS_NAME']
				+ '\');">删除</a>'
				+ '&nbsp;<a href="javascript:void(0);" onclick="javascript:info(\''
				+ record.data['PK_ID'] + '\', \'' + record.data['NS_NAME']
				+ '\');">内容发布</a>'

	}

	return value;
}

function info(id, name) {
	/*
	 * document.location = context +
	 * '/system/tablequery/commonlist.jsp?queryKey=cms_info_list';
	 */
	document.location = context
			+ '/app/cms/info.jsp?queryKey=cms_news_list&cid=' + id
			+ '&cname=' + name + '&ctype=news';

}

function edit(id, name) {
	var tv = new editTableView4QueryList('cms_news_list');
	tv.initTableView('cms_news_edit', id);
}

function del(id, name) {
	deleteTable('cmsnews', 'single', '-1', function(params) {
				params.PK_ID = id;
				return true;
			}, function() {
				reloadTQList('cms_news_list');
			}, null)
}